#ifndef _DAO_H
#define _DAO_H

#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>

#define ADMIN_FILE "admin.txt"
#define STUDENT_FILE "student.txt"
#define TEACHER_FILE "teacher.txt"
#define MAX_ADMIN 1
#define MAX_TEACHER 10
#define MAX_STUDENT 100
#define MAX_PWD_LENGTH 30

typedef struct Student
{
    char name[20];
    char gender;
    char id[20];
    char passwd[20];
    short chinese;
    short english;
    short math;
    short nature;
    short birth;
    short exist;
} Student;

typedef struct Teacher
{
    char name[20];
    char sex;
    char id[20];
    char passwd[20];
    short time;
    short birth;
    short exist;
} Teacher;

typedef struct Admin
{
    char *account;
    char *passwd;
    short birth;
} Admin;

#define ADMIN_SIZE sizeof(Admin)
#define STUDENT_SIZE sizeof(Student)
#define TEACHER_SIZE sizeof(Teacher)

Admin *admin = NULL;
Student *student = NULL;
Teacher *teacher = NULL;

typedef (*scan_buffer)(FILE *fp, int idx);

static uint8_t admin_current_count = 0;
static uint8_t student_current_count = 0;
static uint8_t teacher_current_count = 0;

#endif